//
//  FinishOrderDetailTableViewCell.m
//  rrqs
//
//  Created by mac book on 2019/5/5.
//

#import "FinishOrderDetailTableViewCell.h"

@interface FinishOrderDetailTableViewCell ()




@property(nonatomic,strong) UIImageView* quIcon;
@property(nonatomic,strong) UILabel* quAddressLabel;

@property(nonatomic,strong) UIImageView* songIcon;
@property(nonatomic,strong) UILabel* songAddressLabel;

@end


@implementation FinishOrderDetailTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        [self createSubviews];
        
    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    
    
    
    [self.contentView addSubview:self.quIcon];
    [self.contentView addSubview:self.quAddressLabel];
    [self.contentView addSubview:self.songIcon];
    [self.contentView addSubview:self.songAddressLabel];

    [self.quIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.contentView).offset(10);
        make.height.width.mas_equalTo(25);
        
    }];
    
    [self.quAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.quIcon);
        make.left.equalTo(self.quIcon.mas_right).offset(10);
        make.right.equalTo(self.contentView).offset(-10);

    }];
 
    [self.songIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.quAddressLabel.mas_bottom).offset(10);
        make.left.height.width.equalTo(self.quIcon);
        
    }];
    
    [self.songAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.songIcon);
        make.left.right.equalTo(self.quAddressLabel);
        make.bottom.equalTo(self.contentView).offset(-10);
        
    }];
    
    
    
}


-(void)setEntity:(MOrder *)entity{
    
    
    _entity = entity;
    
    self.quAddressLabel.text = [NSString stringWithFormat:@"%@",entity.send_address];
    self.songAddressLabel.text = [NSString stringWithFormat:@"%@",entity.get_address];
    
    
}
-(UILabel *)songAddressLabel{
    if(!_songAddressLabel){
        _songAddressLabel = [[UILabel alloc]init];
        _songAddressLabel.font = kFontNameSize(14);
        _songAddressLabel.numberOfLines = 0;
        _songAddressLabel.lineBreakMode = NSLineBreakByCharWrapping;
    }
    return _songAddressLabel;
}


-(UIImageView *)songIcon{
    
    if (!_songIcon) {
        _songIcon = [[UIImageView alloc] init];
        _songIcon.image = [UIImage imageNamed:@"icon-sendStatus-light"];
    }
    
    return _songIcon;
}


-(UILabel *)quAddressLabel{
    if(!_quAddressLabel){
        _quAddressLabel = [[UILabel alloc]init];
        _quAddressLabel.font = kFontNameSize(14);
        _quAddressLabel.numberOfLines = 0;
        _quAddressLabel.lineBreakMode = NSLineBreakByCharWrapping;
    }
    return _quAddressLabel;
}


-(UIImageView *)quIcon{
    
    if (!_quIcon) {
        _quIcon = [[UIImageView alloc] init];
        _quIcon.image = [UIImage imageNamed:@"icon-sendStatus-enter"];
    }
    
    return _quIcon;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
